<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

$api = app('Dingo\Api\Routing\Router');


$api->version('v1',['namespace' => 'App\Http\Controllers\Api','providers' => 'jwt','middleware' => 'access'], function ($api) {
    //配置第三方令牌
    $api->any('verify_ticket', 'WeChatController@verify_ticket');//授权回调接收
    $api->any('receive_messages', 'WeChatController@receive_messages');//接收消息
    $api->any('component_access_token', 'WeChatController@component_access_token');//获取令牌
    $api->any('pre_auth_code', 'WeChatController@pre_auth_code');//获取预授权码
    $api->any('startAuth', 'WeChatController@startAuth');//授权注册页面扫码授权url
    $api->any('startAuth_callback', 'WeChatController@startAuth_callback');//授权注册页面扫码授权回调地址
    $api->any('authorizer_refresh_token', 'WeChatController@authorizer_refresh_token');//获取/刷新接口调用令牌
    //代小程序业务
        //设置域名
    $api->any('authorizer_information', 'AuthorizerController@authorizer_information');//获取授权方的帐号基本信息:包括头像、昵称、帐号类型、认证类型、微信号、原始ID和二维码图片URL
    $api->any('server_domain_name', 'AuthorizerController@server_domain_name');//设置服务器域名
    $api->any('business_domain_name', 'AuthorizerController@business_domain_name');//设置业务域名
        //代码模板设置
    $api->any('draft_list', 'AuthorizerController@draft_list');//获取草稿列表
    $api->any('add_to_template', 'AuthorizerController@add_to_template');//将草稿添加到代码模板库
    $api->any('template_list', 'AuthorizerController@template_list');//获取代码模板列表
    $api->any('delete_template', 'AuthorizerController@delete_template');//删除指定代码模版
        //类目管理
    $api->any('get_category', 'AuthorizerController@get_category');//获取审核时可填写的类目信息
        //上传小程序代码
    $api->any('upload_Code', 'AuthorizerController@upload_Code');//上传小程序代码
    $api->any('upload_Code_list', 'AuthorizerController@upload_Code_list');//获取已上传的代码的页面列表
    $api->any('experience_qrcode', 'AuthorizerController@experience_qrcode');//获取体验版二维码
    $api->any('submit_audit', 'AuthorizerController@submit_audit');//提交审核
    $api->any('undocode_audit', 'AuthorizerController@undocode_audit');//审核撤回
    $api->any('get_latest_auditstatus', 'AuthorizerController@get_latest_auditstatus');//查询最新一次提交的审核状态
    $api->any('release', 'AuthorizerController@release');//发布已通过审核的小程序
        //订阅消息设置
    $api->any('getcategory', 'AuthorizerController@getcategory');//获取当前帐号所设置的类目信息
    $api->any('get_template_titles', 'AuthorizerController@get_template_titles');//获取模板标题列表
    $api->any('get_templatekey_words', 'AuthorizerController@get_templatekey_words');//获取模板标题下的关键词库
    $api->any('add_template', 'AuthorizerController@add_template');//组合模板并添加到个人模板库




    $api->group(['middleware' => 'jwt.api.auth'], function ($api) { //验证token生效
        $api->post('user', 'UsersController@user');
        });

});

